package com.longrise.android.byjk.advertisement.admanager;

import android.app.Activity;

import com.longrise.android.byjk.advertisement.InterstitialAD.InterstitialAD;
import com.longrise.android.byjk.advertisement.utils.ADFileUtil;

/**
 * Created by callxkj on 2016/12/14.
 * 广告管理类
 */

public class ADManager {
    private static ADManager mAdmanager = new ADManager();
    private String mRootDir;

    private ADManager(){

    }

    public static ADManager getInstance(){
        if(mAdmanager==null){
            mAdmanager = new ADManager();
        }
        return mAdmanager;
    }

    /**
     * 初始化ADManager
     * @param rootDir 应用的跟文件夹或者缓存文件夹
     */
    public void init(String rootDir){
        this.mRootDir = rootDir+"/AD";
        initFolder(mRootDir);
    }

    /**
     * 设置管辖区域
     * @param managerzoneno 管辖区域
     */
    public void setManagerzoneno(String managerzoneno,String userId){
        ADCacheHelper.getInstance().setUserId(userId);
        ADCacheHelper.getInstance().saveManagerzoneno(managerzoneno);
        //因为执业证可以取消 就不用先缓存是否有广告的信息了
//        if(!TextUtils.isEmpty(managerzoneno)){
//            ADManagerHttpHelper.getInstance().initAdindex();
//        }
    }


    private void initFolder(String rootDir){
        ADFileUtil.initFolder(rootDir);
    }

    /**
     * 制造插屏广告
     * @return
     */
    public InterstitialAD createInterstitialAD(Activity activity){
        return new InterstitialAD(activity);
    }


}
